package com.dataStructure.线性表.数组;

import com.dataStructure.model.Person;

public class 动态数组 {
    public static void main(String[] args) {
        int[] array =new int[] {11, 22, 33};

        ArrayList<Integer> list = new ArrayList();
        list.add(99);
        list.add(88);
        list.add(77);
        list.add(66);
        list.add(55);
        for (int i = 0; i < 20; i++) {
            list.add(i);
        }

//        list.add(0,100);
        System.out.println(list.size());
        list.set(3,80);
        if (list.get(3)!= 80){
            throw new IllegalArgumentException("参数错误");
        }else {
            System.out.println("测试通过");
        }
        //Asserts.test(list.remove(0)==80);
        int i = list.get(1);
        System.out.println(i);
        list.clear();
        System.out.println(list);

        ArrayList<Person> arrayList = new ArrayList<>();
        arrayList.add(new Person(12, "jack"));
        arrayList.add(new Person(13, "mary"));
        arrayList.add(new Person(14,"daouble"));
        arrayList.clear();
        System.out.println(arrayList);
        for (int j = 0; j < 10; j++) {
            System.out.println(j);
        }
    }
}
